1 describe("Lex 仕様 0.1", function() {
  2   var exp = "1+2=";
  3   var la;
  4   var retval;
  5 
  6   beforeEach(function() {
  7     la = new Lex(exp);	// Lexical Analiser
  8   });
  9 
 10   it("eod() は false を返す", function() {
 11     expect(la.eod()).toBeFalsy();
 12   });
 13 
 14   it("digit() は '1' を返す", function() {
 15     expect(la.digit()).toEqual('1');
 16   });
 17 
 18   it("upper() は null を返す", function() {
 19     expect(la.upper()).toBeNull();
 20   });
 21 
 22   it("lower() は null を返す", function() {
 23     expect(la.lower()).toBeNull();
 24   });
 25 
 26   it("ch('1') は '1' を返す", function() {
 27     expect(la.ch('1')).toEqual('1');
 28   });
 29 
 30   describe("3文字読んだ時点で、", function() {
 31     beforeEach(function() {
 32       la.rewind();
 33       la.digit();
 34       la.ch('+');
 35       la.digit();
 36     });
 37 
 38     it("eod() は false を返す", function() {
 39       expect(la.eod()).toBe(false);
 40     });
 41 
 42     it("digit() は null を返す", function() {
 43       expect(la.digit()).toBe(null);
 44     });
 45 
 46     it("upper() は null を返す", function() {
 47       expect(la.upper()).toBe(null);
 48     });
 49 
 50     it("lower() は null を返す", function() {
 51       expect(la.lower()).toEqual(null);
 52     });
 53 
 54     it("ch('=') は '=' を返す", function() {
 55       expect(la.ch('=')).toBe('=');
 56     });
 57 
 58   });
 59 
 60   describe("4文字読んだ時点で、", function() {
 61     beforeEach(function() {
 62       la.rewind();
 63       la.digit();
 64       la.ch('+');
 65       la.digit();
 66       la.ch('=');
 67     });
 68 
 69     it("eod() は true を返す", function() {
 70       expect(la.eod()).toBeTruthy();
 71     });
 72 
 73   });
 74 
 75 });
 76